package com.example.news.controller;

import com.example.news.bean.News;
import com.example.news.bean.User;
import com.example.news.service.NewsService;
import com.example.news.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 新闻信息接口
 */
@RestController
public class NewsController {
    @Autowired
    NewsService newsService;
    @RequestMapping("/insertNews")
    public Map<String,Object> insertNews(News news){
        return newsService.insertNews(news);
    }

    /**
     * 通过类型id查询新闻
     * @param type_id
     * @return
     */
    @RequestMapping("/selectNewsByTypeId")
    public Map<String,Object> selectNewsByTypeId(Integer type_id){
        return newsService.selectNewsByTypeId(type_id);
    }

}
